//    Copyright (C) Kherty.  All rights reserved.
using OpenLS.Core.Serialization;
using OpenLS.Vml.Serialization;

namespace OpenLS.Vml.Drawing
{
    class Lock: ShapeElement
    {
        private Ext? _ext;
        private bool? _position;
        private bool? _grouping;
        private bool? _ungrouping;
        private bool? _rotation;
        private bool? _cropping;
        private bool? _verticies;
        private bool? _adjusthandles;
        private bool? _aspectratio;
        private bool? _text;
        private bool? _shapetype;
        private bool? _selection;
        internal const string xmlName = "lock";
        internal override void ReadXmlCore(ReadContext context)
        {
            using (var c = context.Read(VmlConstants.OfficeNamespace + xmlName))
            {
                _ext = c.GetOptionalEnum<Ext>(VmlConstants.VmlNamespace + "ext");
                _position = c.GetOptionalBoolean("position");
                _selection = c.GetOptionalBoolean("selection");
                _grouping = c.GetOptionalBoolean("grouping");
                _ungrouping = c.GetOptionalBoolean("ungrouping");
                
                _rotation = c.GetOptionalBoolean("rotation");
                _cropping = c.GetOptionalBoolean("cropping");

                _verticies = c.GetOptionalBoolean("verticies");
                _adjusthandles = c.GetOptionalBoolean("adjusthandles");
                _text = c.GetOptionalBoolean("text");
                _aspectratio = c.GetOptionalBoolean("aspectratio");

                _shapetype = c.GetOptionalBoolean("shapetype");

            }
        }

        internal override void WriteXmlCore(WriteContext context)
        {
            using (var c = context.Write(VmlConstants.OfficeNamespace + xmlName))
            {
                c.SetOptionalEnum<Ext>(VmlConstants.VmlNamespace + "ext", _ext);
                c.SetOptionalBoolean("position", _position );
                c.SetOptionalBoolean("selection", _selection );
                c.SetOptionalBoolean("grouping", _grouping );
                c.SetOptionalBoolean("ungrouping", _ungrouping );
                
                c.SetOptionalBoolean("rotation", _rotation );
                c.SetOptionalBoolean("cropping", _cropping );

                c.SetOptionalBoolean("verticies", _verticies );
                c.SetOptionalBoolean("adjusthandles", _adjusthandles );
                c.SetOptionalBoolean("text", _text );
                c.SetOptionalBoolean("aspectratio", _aspectratio );

                c.SetOptionalBoolean("shapetype", _shapetype );

            }
        }
    }
}

